#define _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>

int main() {
    int a = 0;
    int b = 0;
    while (scanf("%d %d", &a, &b) != EOF)
    {
        int arr[100][100];
        int i = 0;
        int j = 0;
        for (i = 0; i < a; i++)
        {
            for (j = 0; j < b; j++)
            {
                scanf("%d", &arr[i][j]);
            }
        }
        int arr1[100][100];
        for (i = 0; i < a; i++)
        {
            for (j = 0; j < b; j++)
            {
                arr1[i][j] = 1;
                for (int n = 0; n < a; n++)
                {
                    if (n != i)
                    {
                        arr1[i][j] *= arr[n][j];
                    }
                }
                for (int n = 0; n < b; n++)
                {
                    if (n != j)
                    {
                        arr1[i][j] *= arr[i][n];
                    }
                }
            }
        }
        int max = 0;
        for (i = 0; i < a; i++)
        {
            for (j = 0; j < b; j++)
            {
                if (max < arr1[i][j])
                {
                    max = arr1[i][j];
                }
            }
        }
        printf("%d\n", max);
    }
    return 0;
}